﻿@inject BaseWebElement _baseWebElement;
@inject IHttpContextAccessor _httpContext;
@{
    var routeValues = _httpContext.HttpContext.Request.RouteValues;
    var path = _httpContext.HttpContext.Request.Path.ToString();
    var language = _baseWebElement.Currentlanguage;
    var languages = _baseWebElement.GetLanguageType();
    var logo = _baseWebElement.GetWebElement(WebElementType.Logo)?.Img;
    var Tel = _baseWebElement.GetWebElement(WebElementType.Tel)?.Value;
    var Phone = _baseWebElement.GetWebElement(WebElementType.Phone)?.Value;
    var Email = _baseWebElement.GetWebElement(WebElementType.Email)?.Value;
    var CompanyName = _baseWebElement.GetWebElement(WebElementType.CompanyName)?.Value;
    var Address = _baseWebElement.GetWebElement(WebElementType.Address)?.Value;
    var QQ = _baseWebElement.GetWebElement(WebElementType.QQ)?.Value;
    var StatisticalCode = _baseWebElement.GetWebElement(WebElementType.StatisticalCode)?.Value;
    var RecordInformation = _baseWebElement.GetWebElement(WebElementType.RecordInformation)?.Value;
    var webHome = _baseWebElement.GetWebHome();
    var contentClass = _baseWebElement.GetContentClass();
    var Links = _baseWebElement.GetFriendLink();
    var news = _baseWebElement.GetNewsInfos();
    var currentlanguageclass = language.IsDefault == 1 ? "/" : "/" + language.LanguageClass + "/";
    var NotLanguageRoute = _baseWebElement.GetNotLanguageRoute();
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="renderer" content="webkit" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <meta name="author" content="" />
    <meta name="format-detection" content="telephone=no" />
    <title>@ViewData["Title"]</title>
    <meta name="keywords" content="@ViewData["keywords"]" />
    <meta name="description" content="@ViewData["description"]" />
    <!----自适应----->
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css" asp-append-version="true" />
    <link rel="stylesheet" type="text/css" href="/iconfont/iconfont.css" asp-append-version="true" />
    <script src="/js/jquery-3.6.0.min.js"></script>
    <link rel="stylesheet" type="text/css" href="/css/common.css" asp-append-version="true" />
    <link rel="stylesheet" type="text/css" href="/css/swiper-3.4.2.min.css" asp-append-version="true" />
    <link rel="stylesheet" type="text/css" href="/css/index.css" asp-append-version="true" />
    @RenderSection("css", false)
    <script>
        if (navigator.appName == "Microsoft Internet Explorer" && (navigator.appVersion.match(/7./i) == "7." || navigator.appVersion.match(/8./i) == "8." || navigator.appVersion.match(/9./i) == "9.")) {
            self.location.href = "/ie/ie.html"
        }
    </script>
    <script src="/js/easing.js" asp-append-version="true"></script>
    <script src="/js/bootstrap.min.js" asp-append-version="true"></script>
    <!----自适应----->
    <script src="/js/index.js" asp-append-version="true"></script>
    <!--[if lte IE 9]>
       <script src="js/respond.min.js"></script>
       <script src="js/html5shiv.js"></script>
    <![endif]-->
    @RenderSection("js", false)
</head>
<body>
    <!--  / header  -->
    <div class="header hidden-xs">
        <div class="webTop">
            <div class="container">
                <span>@(_baseWebElement.QueryLanText("welcome"))@(CompanyName)</span>
                <div class="rBox">
                    <ul class="clearfix">
                        <li><i class="iconfont">&#xe69a;</i> @Tel</li>
                        <li><i class="iconfont">&#xe6a5;</i>@Phone</li>
                        <li><i class="iconfont">&#xe6ed;</i><a href="mailTo:@Email">@Email</a></li>
                        <li>
                            Language:
                            <select id="languageClass">
                                @if (languages.Count > 0)
                                {
                                    foreach (var item in languages)
                                    {
                                        <option value="@item.LanguageClass" data-isDefault="@item.IsDefault">@item.Language</option>
                                    }
                                }
                            </select>
                            <i class="iconfont">&#xe629;</i>
                        </li>
                    </ul>
                </div>
            </div>

        </div>
        <div class="headerTop">
            <div class="container">
                <div class="logo"><a href="@(currentlanguageclass)"><img src="@logo" alt="logo" width="100%" /></a></div>
                <div class="topRight clearfix">
                    <div class="search">
                        <input type="text" name="searchText" value="@ViewData["searchText"]" placeholder="@(_baseWebElement.QueryLanText("searchPlace"))" /><button onclick="search(this,false)"><i class="iconfont">&#xe60b;</i></button>
                    </div>
                </div>
            </div>
        </div>
        <div class="nav">
            <div class="container">
                <div class="logo2">
                    <a href="@(currentlanguageclass)"><img src="@logo" /></a>
                </div>
                <div class="menu">
                    <ul>
                        <li class="oneMenu @(routeValues.Values.Contains("Home") && routeValues.Values.Contains("Index") ? Html.Raw("activeMenu") : null)"><a href="@(currentlanguageclass)">@(_baseWebElement.QueryLanText("Home"))</a></li>
                        @foreach (var topClass in contentClass.Where(m => m.ParentId == 0))
                        {
                            var href = topClass.Path;
                            if (topClass.ClassType == (int)ClassType.News)
                            {
                                href = "news";
                            }
                            else if (topClass.ClassType == (int)ClassType.Products)
                            {
                                href = "products";
                            }
                            <li class="oneMenu @(_baseWebElement.IsOnPath(href) ? Html.Raw("activeMenu") : null)">
                                <a href="@(currentlanguageclass + href)">@(topClass.ClassName)</a>
                                @{
                                    var childrens = contentClass.Where(m => m.ParentId == topClass.Id);
                                    if (childrens.Count() > 0)
                                    {
                                        <div class="menu_down">
                                            <ul>
                                                @foreach (var ch in childrens)
                                                {
                                                    if (ch.ClassType == (int)ClassType.Content)
                                                    {
                                                        <li><a href="@(currentlanguageclass + ch.Path)">@ch.ClassName</a></li>
                                                    }
                                                    else if (ch.ClassType == (int)ClassType.News)
                                                    {
                                                        <li><a href="@(currentlanguageclass)news/catelog/@(ch.Id).html">@ch.ClassName</a></li>
                                                    }
                                                    else if (ch.ClassType == (int)ClassType.Products)
                                                    {
                                                        <li><a href="@(currentlanguageclass)products/catelog/@(ch.Id).html">@ch.ClassName</a></li>
                                                    }
                                                }
                                            </ul>
                                        </div>
                                    }
                                }
                            </li>
                        }
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <!--  / header  -->
    <!--  / 移动端  -->
    <div class="headerPhone visible-xs">
        <div class="headerPhoneTop">
            <a class="menu-trigger" href="javascript:void(0);">
                <span></span><span></span><span></span>
            </a>
            <div class="headerPhoneLogo">
                <a href="@(currentlanguageclass)"><img src="@logo" /></a>
            </div>
            <div class="menu_tr_ico">
                <a href="mailto:@Email" title="email:@Email"><i class="iconfont">&#xe6ed;</i></a>
                <a href="javascript:;" class="lang_icon"><i class="iconfont">&#xe60f;</i></a>
                <div class="selectBox">
                    <ul>
                        @if (languages.Count > 0)
                        {
                            foreach (var item in languages)
                            {
                                <li><a href="@(item.IsDefault == 1 ? "/" : "/" + item.LanguageClass)">@item.Language</a></li>
                            }
                        }
                    </ul>
                </div>
            </div>
        </div>
        <div class="menu_tr_search">
            <input type="text" name="searchText" value="@ViewData["searchText"]" placeholder="search" onfocus="this.placeholder=''" onblur="this.placeholder='search'" />
            <button onclick="search(this,true)"><i class="iconfont">&#xe60b;</i></button>
        </div>
        <div class="menuPhone">
            <ul>
                <li>
                    <h2><a href="@(currentlanguageclass)">@(_baseWebElement.QueryLanText("Home"))</a></h2>
                </li>
                @foreach (var topClass in contentClass.Where(m => m.ParentId == 0))
                {
                    <li>
                        @{
                            var href = topClass.Path;
                            if (topClass.ClassType == (int)ClassType.News)
                            {
                                href = "news/";
                            }
                            else if (topClass.ClassType == (int)ClassType.Products)
                            {
                                href = "products/";
                            }
                        }
                        <h2><a href="@(currentlanguageclass + href)">@(topClass.ClassName)</a></h2>
                        @{
                            var childrens = contentClass.Where(m => m.ParentId == topClass.Id);
                            if (childrens.Count() > 0)
                            {
                                <div class="menuPhoneHide">
                                    @foreach (var ch in childrens)
                                    {
                                        if (ch.ClassType == (int)ClassType.Content)
                                        {
                                            <h5><a href="@(currentlanguageclass + ch.Path)">@ch.ClassName</a></h5>
                                        }
                                        else if (ch.ClassType == (int)ClassType.News)
                                        {
                                            <h5><a href="@(currentlanguageclass)news/catelog/@(ch.Id).html">@ch.ClassName</a></h5>
                                        }
                                        else if (ch.ClassType == (int)ClassType.Products)
                                        {
                                            <h5><a href="@(currentlanguageclass)products/catelog/@(ch.Id).html">@ch.ClassName</a></h5>
                                        }
                                    }
                                </div>
                            }
                        }
                    </li>
                }
            </ul>
        </div>
    </div><!--  / 移动端  -->
    @RenderBody()
    <!--  / footer  -->
    <div class="footer">
        <div class="container" style=" position:relative;">
            <div class="footerwarp hidden-xs">
                <div class="row">
                    <div class="col-md-4 indContact">
                        <h2>@(_baseWebElement.QueryLanText("Contactus"))</h2>
                        @if (!Address.IsNullOrWhiteSpace())
                        {
                            <P>@(_baseWebElement.QueryLanText("Address")):@Address</P>
                        }
                        @if (!Tel.IsNullOrWhiteSpace())
                        {
                            <P>@(_baseWebElement.QueryLanText("Tel")):@Tel</P>
                        }
                        @if (!Phone.IsNullOrWhiteSpace())
                        {
                            <P>@(_baseWebElement.QueryLanText("Phone")):@Phone</P>
                        }
                        @if (!Email.IsNullOrWhiteSpace())
                        {
                            <P>@(_baseWebElement.QueryLanText("Email")):<a href="mailTo:@Email">@Email</a></P>
                        }
                    </div>
                    @if (news != null && news.Count > 0)
                    {
                        <div class="col-md-5 news">
                            <h2>@(_baseWebElement.QueryLanText("News"))</h2>
                            <ul class="newsLi">
                                @foreach (var newinfo in news.Take(4))
                                {
                                    <li><a href="@(currentlanguageclass)news/detail/@(newinfo.Id).html">@(newinfo.Title)</a><span>@(newinfo.NewsTime.ToDateTime().Value.ToString("yyyy-MM-dd"))</span></li>
                                }
                            </ul>
                        </div>
                    }
                    <div class="col-md-3 webMap">
                        <h2>@(_baseWebElement.QueryLanText("WebSiteMaps"))</h2>
                        <a href="@(currentlanguageclass)">@_baseWebElement.QueryLanText("Home")</a>
                        @foreach (var topClass in contentClass.Where(m => m.ParentId == 0))
                        {
                            if (topClass.ClassType == (int)ClassType.Content)
                            {
                                <a href="@(currentlanguageclass + topClass.Path)">@topClass.ClassName</a>
                            }
                            else if (topClass.ClassType == (int)ClassType.News)
                            {
                                <a href="@(currentlanguageclass)news/">@topClass.ClassName</a>
                            }
                            else if (topClass.ClassType == (int)ClassType.Products)
                            {
                                <a href="@(currentlanguageclass)products/">@topClass.ClassName</a>
                            }
                        }
                    </div>
                </div>
            </div>
            @if (Links != null && Links.Count > 0)
            {
                <div class="links">
                    Links:
                    @foreach (var link in Links)
                    {
                        <a href="@link.LinkUrl" title="@link.Title"><img src="@link.img" /></a>
                    }
                    <a href="mailTo:@Email" class="email" title="@Email"><img src="/images/links/email.png" /></a>
                </div>
            }
        </div>
        <div class="footercopy">
            <div class="container">
                <div class="row">
                    <div class="col-lg-6 col-md-6 col-sm-6">
                        <div class="copy">
                            Copyright © @DateTime.Now.Year <span>@CompanyName</span>
                            @if (!RecordInformation.IsNullOrWhiteSpace())
                            {
                                <a href="https://beian.miit.gov.cn/" style="float: none;" rel="nofollow" target="_blank">@(RecordInformation)</a>
                            }
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <!--  / footer  -->
    <div class="emailFix">
        <a href="mailTo:@Email" class="mail" title="@Email"><i class="iconfont">&#xe6ed;</i></a>
    </div>
    <div class="goTop">
        <a href="javascript:;" class="kefu-top" rel="nofollow"><i class="iconfont">&#xe649;</i></a>
    </div>
    @if (!StatisticalCode.IsNullOrWhiteSpace())
    {
        <div style="display:none">
            @Html.Raw(StatisticalCode)
        </div>
    }
</body>
<script src="/js/swiper-3.4.2.min.js" asp-append-version="true"></script>
<script>
    $(document).ready(function (e) {
        if ($(window).width() > 768) {
            var mySwiper1 = new Swiper('.swiperPro', {
                autoplay: 5000,
                slidesPerView: 4,
                spaceBetween: 20,
                paginationClickable: true,
                autoplayDisableOnInteraction: false,
                prevButton: '.swiper-button-prev',
                nextButton: '.swiper-button-next',
            })

        } else {
            var mySwiper1 = new Swiper('.swiperPro', {
                autoplay: 5000,
                slidesPerView: 1,
                spaceBetween: 20,
                paginationClickable: true,
                autoplayDisableOnInteraction: false,
                prevButton: '.swiper-button-prev',
                nextButton: '.swiper-button-next',
            })
        }
        //语言选择实现
        var lClass = '@(language.LanguageClass)'
        $("#languageClass").val(lClass);
        $("#languageClass").change(function () {
            var route = '@NotLanguageRoute';
            var isDefault = $(this).find("option:selected").attr("data-isDefault");
            var value = document.getElementById("languageClass").value;
            if (isDefault == 1) {
                location.replace(route);
            }
            else {
                location.replace("/" + value + route);
            }
        });
    });

    function search(obj) {
        var searchText = $(obj).parent().find("[name=searchText]").val();
        var lClass = '@(currentlanguageclass)'
        var custDefault =@(_baseWebElement.Currentlanguage.IsDefault);
        if (custDefault == 1) {
            location.replace("/products?searchText=" + searchText);
        } else {
            location.replace(lClass + "products?searchText=" + searchText);
        }
        
    }
</script>
<!--  / banner切换  -->
@RenderSection("Scripts", false)
</html>



